<template>
    <div class="stock-wrapper ui pc">
        <div class="date-model">
            <label><input type="radio"  checked value="1" class="hidden" v-model="is_quantity_date">
                日历模式</label>
            <label><input type="radio" v-model="is_quantity_date" value="0" class="hidden">
                单一模式</label>
        </div>
        <component :is="componentName" :dateShowContent='dateShowContent' :disable="false" @upStockData='updateStockData' :productData='productData'></component>
    </div>
</template>
<script>
    import tool from 'src/util/tool';
    import util from '_util/index';
    import logic from '_logic';

    //子组件
    import singleStock from '../stock/singleStock.vue'
    import dateStock from '../stock/dateStock.vue'

    export default {
        components:{
            singleStock,dateStock
        },
        data() {
            return {
                val: null,
                attrs: [],
                units: [],
                is_quantity_date:'0',
                productData:{},
				dateShowContent:[
				// 	{
				// 	name:'price',
				// 	label:'成本价(￥)'
				// },
				{
					name:'quantity',
					label:'库存(份)'
				}]
            }
        },
        watch: {},
        methods: {
            updateStockData(data){
              let _this=this;
                this.$emit('onchange',{name:5,data:{
                    is_quantity_date:_this.is_quantity_date,
                    data:data
                }})
            }
        },
        computed: {
            componentName(){
                return this.is_quantity_date*1?'dateStock':'singleStock'
            }
        },
        mounted() {

        },
        props: ['params'],
        created() {
          if(this.params.data[5]){
            this.is_quantity_date = this.params.data[5].is_quantity_date;
            this.productData = this.params.data[5].data;
          }
        },
        mounted(){

        }
    }
</script>
<style rel="stylesheet/less" scoped lang="less">
    @import "../../../common/style/mixin";
    .stock-wrapper{
        .date-model{
            font-size: 18px;
        }
        .stock-action{
            text-align: center;
            margin-top: 20px;
        }
    }
</style>
